package com.study.spring.thread;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author
 * @date 2021年11月21日 20:42
 * @description
 */
@Service
public class AsynService {
    private static final Logger logger = LoggerFactory.getLogger(AsynService.class);


    @Async("test1")
    void Test1(){


        logger.info("start executeAsync:"+Thread.currentThread().getName());

        System.out.println("异步线程要做的事情");
        System.out.println("可以在这里执行批量插入等耗时的事情");

        logger.info("end executeAsync");
    }


    @Async("test2")
    void Test2(){


        logger.info("start executeAsync:"+Thread.currentThread().getName());

        System.out.println("异步线程要做的事情");
        System.out.println("可以在这里执行批量插入等耗时的事情");

        logger.info("end executeAsync");
    }

}
